#ifndef WIDGET_H
#define WIDGET_H

#include <QAbstractTableModel>
#include <QWidget>
#include <QString>
#include "biblist.h"

class BookTableModel : public QAbstractTableModel
{
    Q_OBJECT

public:
    explicit BookTableModel(QWidget *parent = nullptr);
    explicit BookTableModel(QString const & input, QWidget *parent = nullptr);
    ~BookTableModel();

    virtual int rowCount(const QModelIndex &parent=QModelIndex()) const override;
    virtual int columnCount(const QModelIndex &parent=QModelIndex()) const override;
    QVariant data(const QModelIndex &index, int role) const override;
    QVariant headerData(int section, Qt::Orientation orientation, int role) const override;

    void addItem(QString const &);

    bibList list;
    QStringList headers;
    void erase(int index);
private:
    QModelIndex current;
    void populataModel();
};
#endif // WIDGET_H
